/*
Copyright (C) 2008, 2009 Henrik Naess

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/

using System;
using System.Collections.Generic;
using System.ComponentModel;
using ZoneFiveSoftware.Common.Visuals.Fitness;

namespace MatrixPlugin
{
    internal class ExtendSettingPage : IExtendSettingsPages
    {
        #region IExtendSettingsPages Member

        public class MatrixPluginSettingPage : ZoneFiveSoftware.Common.Visuals.ISettingsPage, IDisposable
        {
            #region ISettingsPage Member

            public Guid Id
            {
                get { return GUIDs.Settings; }
            }

            public IList<ZoneFiveSoftware.Common.Visuals.ISettingsPage> SubPages
            {
                get { return null; }
            }

            #endregion

            #region IDialogPage Member

            private SettingsUC crpcontrol;

            public System.Windows.Forms.Control CreatePageControl()
            {
                crpcontrol = new SettingsUC();
                return crpcontrol;
            }

            public bool HidePage()
            {
                return true;
            }

            public string PageName
            {
                get { return Properties.Resources.ApplicationName; }
            }

            public void ShowPage(string bookmark)
            {
            }

            public ZoneFiveSoftware.Common.Visuals.IPageStatus Status
            {
                get { return null; }
            }

            public void ThemeChanged(ZoneFiveSoftware.Common.Visuals.ITheme visualTheme)
            {
                crpcontrol.ThemeChanged(visualTheme);
            }

            public string Title
            {
                get { return Properties.Resources.ApplicationName; }
            }

            public void UICultureChanged(System.Globalization.CultureInfo culture)
            {
                if (crpcontrol != null)
                {
                    crpcontrol.UICultureChanged(culture);
                }
            }

            #endregion

            #region INotifyPropertyChanged Member

            public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

            #endregion

            #region Private methods

            private void OnPropertyChanged(string propertyName)
            {
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
                }
            }

            #endregion

            public void Dispose()
            {
                this.crpcontrol.Dispose();
            }
        }

        public IList<ZoneFiveSoftware.Common.Visuals.ISettingsPage> SettingsPages
        {
            get { return new ZoneFiveSoftware.Common.Visuals.ISettingsPage[1] {new MatrixPluginSettingPage()}; }
        }

        #endregion
    }
}